$(function () {
    var i = "pop-in";
    mui("body").on("tap", "a", function () {
        var e = this.getAttribute("href"), t = this.href;
        mui.openWindow({id: e, url: t, styles: {popGesture: "close"}, show: {aniShow: i}, waiting: {autoShow: !0}})
    });
    var e = function (i) {
        if (1 == i.code) {
            if (i.bannerList && i.bannerList.length) {
                var e = i.bannerList, t = $(".mui-slider .mui-slider-group"), a = $(".mui-slider .mui-slider-indicator");
                if (t.empty(), a.empty(), e[0].PIC_PATH = "http://www.dcloud.io/hellomui/images/cbd.jpg", 1 == e.length)t.append('<div class="mui-slider-item"><a href="' + (e[0].IS_LINK ? e[0].LINK_URL : "#") + '"><img src="' + (e[0].PIC_PATH || "") + '"></a></div>'); else {
                    t.append('<div class="mui-slider-item mui-slider-item-duplicate"><a href="' + (e[e.length - 1].IS_LINK ? e[e.length - 1].LINK_URL : "#") + '"><img src="' + (e[e.length - 1].PIC_PATH || "") + '"></a></div>');
                    for (var s = 0; s < e.length; s++)t.append('<div class="mui-slider-item"><a href="' + (e[s].IS_LINK ? e[s].LINK_URL : "#") + '"><img src="' + (e[s].PIC_PATH || "") + '"></a></div>'), a.append('<div class="mui-indicator ' + (0 == s ? "mui-active" : "") + '"></div>');
                    t.append('<div class="mui-slider-item mui-slider-item-duplicate"><a href="' + (e[0].IS_LINK ? e[0].LINK_URL : "#") + '"><img src="' + (e[0].PIC_PATH || "") + '"></a></div>');
                    var n = mui(".mui-slider");
                    n.slider({interval: 5e3})
                }
            }
        } else mui.toast(i.message)
    }, t = function (i) {
        if (1 == i.code) {
            if (console.log(i), i.recommendList && i.recommendList.length) {
                var e = i.recommendList;
                $(".recommend-pic").append('<a href="' + (e[0].IS_LINK ? e[0].LINK_URL : "#") + '"><img src="' + (e[0].PIC_PATH || "") + '"></a><a href="' + (e[1].IS_LINK ? e[1].LINK_URL : "#") + '"><img src="' + (e[1].PIC_PATH || "") + '"></a><a href="' + (e[2].IS_LINK ? e[2].LINK_URL : "#") + '"><img src="' + (e[2].PIC_PATH || "") + '"></a>'), $(".activity-recommend").find("p:eq(0)").text(e[0].ACTIVITY_DESC), $(".activity-recommend").find("p:eq(1)").text(e[1].ACTIVITY_DESC), $(".activity-recommend").find("p:eq(2)").text(e[2].ACTIVITY_DESC)
            }
        } else mui.toast(i.message)
    }, a = function (i) {
        if (1 == i.code) {
            if (console.log(i), i.hotList && i.hotList.length) {
                for (var e = i.hotList, t = 0; t < e.length; t++)$(".mui-table-view").append('<li class="mui-table-view-cell activity-jump" data-id="' + e[t].MARKETINGACTIVITY_ID + '">' + (e[t].TITLE || "") + "</li>");
                mui("body").on("tap", ".activity-jump", function () {
                    var i = $(this).attr("data-id");
                    setTimeout(function () {
                        mui.openWindow({
                            id: "activity-details.html",
                            url: "activity-details.html?MARKETINGACTIVITY_ID=" + i,
                            styles: {popGesture: "close"},
                            show: {aniShow: "pop-in"},
                            waiting: {autoShow: !0}
                        })
                    }, 100)
                })
            }
        } else mui.toast(i.message)
    }, s = new common, n = {
        url: s.hostUrl + "mobileappmarketing/recommendActivity.do",
        data: {FKEY: s.getKey("recommendActivity")},
        success: t
    };
    n = $.extend({}, s.ajaxOption, n), $.ajax(n);
    var o = {url: s.hostUrl + "mobileappmarketing/hotActivity.do", data: {FKEY: s.getKey("hotActivity")}, success: a};
    o = $.extend({}, s.ajaxOption, o), $.ajax(o);
    var r = {url: s.hostUrl + "mobileappbanner/findBannerInfo.do", data: {FKEY: s.getKey("bannerList")}, success: e};
    r = $.extend({}, s.ajaxOption, r), $.ajax(r)
});